package com.lry.pda.bottom.c.backend.type;

import lombok.Data;

@Data
public class Specifier {

    //type
    public static int  NONE = -1;
    public static int  INT = 0;
    public static int  CHAR = 1;
    public static int  VOID = 2;
    public static int  STRUCTURE = 3;
    public static int  SHORT = 4;
    public static int  LONG = 5;
    public static int  DOUBLE = 6;
    public static int  FLOAT = 7;
    public static int  BOOLEAN = 8;

    //storage
    public static int  FIXED = 0;
    public static int  REGISTER = 1;
    public static int  AUTO = 2;
    public static int  TYPEDEF = 3;
    public static int  CONSTANT = 4;

    public static int  NO_OCLASS = 0;  //如果内存类型是auto, 那么存储类型就是NO_OCLASS
    public static int  PUBLIC = 1;
    public static int  PRIVATE = 2;
    public static int  EXTERN = 3;
    public static int  COMMON = 4;

    private int type;

    private int storageClass;

    private int outputClass= NO_OCLASS;

    private boolean isSigned;

    private boolean isStatic;

    private boolean isExternal;

    private int constantValue;

    private StructDefine  vStruct;

    public Specifier(){}

    public Specifier(int type, boolean isSigned) {
        this.type = type;
        this.isSigned = isSigned;
    }

    public void copy(Specifier dst) {
        dst.setType(this.getType());
        dst.setConstantValue(this.getConstantValue());
        dst.setExternal(this.isExternal());
        dst.setOutputClass(this.getOutputClass());
        dst.setSigned(this.isSigned());
        dst.setStatic(this.isStatic());
        dst.setStorageClass(this.getStorageClass());
    }
}
